package com.wt.chat.controller;

import com.wt.chat.context.ContextHolder;
import com.wt.chat.entity.User;
import com.wt.chat.response.ResponseResult;
import com.wt.chat.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @description
 * @author: wangtao
 * @date:16:38 2019/11/18
 * @email:taow02@jumei.com
 */
@Controller
@RequestMapping("/user")
public class UserController {

	@Autowired
	private UserService userService;

	@RequestMapping("/info")
	public ResponseResult info() {
		Integer userId = ContextHolder.currentUserId();
		User user = userService.findById(userId);
		return new ResponseResult().code(0).body(user);
	}

}
